﻿@{
    ViewBag.Title = "合伙人申请列表";
}
@section headerSection{
    <style>
        #exampleToolbar > .form-group {
            float: left;
            margin: 0;
            margin-left: 5px;
        }
    </style>
}
<div class="animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins" style="margin-bottom: 0px;">
        <div class="ibox-content" style="padding: 5px 20px 0px 20px;">
            <div class="row row-lg">
                <div class="col-sm-12 col-sm-leftRight">
                    <!-- Example Toolbar -->
                    <div class="example">
                        <div class="btn-group hidden-xs" id="exampleToolbar" role="group">
                            <div class="form-group" style="margin-left:0;width:180px;">
                                <select id="applyStatus" name="applyStatus" title="请选择状态" data-live-search="true" class="form-control show-tick selectpicker" placeholder="请选择状态">
                                    <option value="-1" selected>全部</option>
                                    <option value="0">待审核</option>
                                    <option value="1">已通过</option>
                                    <option value="2">未通过</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <button id="btnSearch" class="btn btn-primary" type="button"><i class="fa fa-search"></i>&nbsp;查询</button>
                            </div>
                        </div>
                        <table id="exampleTableToolbar" data-mobile-responsive="true" data-radio="true"></table>
                    </div>
                    <!-- End Example Toolbar -->
                </div>
            </div>
        </div>
    </div>
    <!-- End Panel Other -->
</div>
@section footSection{
    <script>
        var options, $table;
        var partnerManager = {
            initPage: function () {
                partnerManager.initTable();
                partnerManager.bindEvent();
            },
            //初始化Table
            initTable: function() {
                options = {
                    url: ctx + "/VRPartner/InitApplyTable",
                    cutHeight: 5,
                    toolbar: "#exampleToolbar",
                    queryParams: function(params) {
                        params = {
                            //页面大小  
                            rows: params.limit,
                            //第几页
                            page: params.offset / params.limit + 1,
                            applyStatus: $('#applyStatus').val()
                        }
                        return params;
                    },
                    columns: [
                        {
                            radio: true
                        }, {
                            field: '', //第一列序号
                            title: '序号',
                            align: 'center',
                            width: 50,
                            formatter: function(value, row, index) {
                                return index + 1;
                            }
                        }, {
                            field: 'user_name',
                            title: '申请人',
                            align: 'center'
                        }, {
                            field: 'apply_date',
                            title: '申请时间',
                            align: 'center'
                        }, {
                            field: 'folder_name',
                            title: '商家名称',
                            align: 'center'
                        }, {
                            field: 'ref_name',
                            title: '推荐人',
                            align: 'center'
                        },{
                            field: 'apply_status',
                            title: '状态',
                            align: 'center',
                            formatter: function (value, row, index) {
                                if (value === 0)
                                    return "待审核";
                                else if (value === 1)
                                    return "已通过";
                                else
                                    return "未通过";
                            }
                        }, {
                            field: 'approve_name',
                            title: '审核人',
                            align: 'center'
                        }, {
                            field: 'approve_date',
                            title: '审核时间',
                            align: 'center'
                        }, {
                            field: 'approve_note',
                            title: '审核意见',
                            align: 'center',
                            formatter: function (value, row, index) {
                                if (value && value.toString().length > 15)
                                    return "<span title='" + value + "'>" + value.substring(0, 15) + "...</span>";
                                else
                                    return "";
                            }
                        }]
                }
                $table = tableHelper.initTable("exampleTableToolbar", options);
            },
            //绑定事件
            bindEvent: function() {
                //查询
                $('#btnSearch').click(function () {
                    $table.bootstrapTable('refresh', options);
                });
            }
        }
        $(function() {
            partnerManager.initPage();
        });
    </script>
}